package com.framework.modules.sys.controller;

import com.framework.yhbEntity.sys.YhbSysUser;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * Controller公共组件
 */
public abstract class AbstractController {
	protected Logger logger = LoggerFactory.getLogger(getClass());

	protected YhbSysUser getUser() {
		return (YhbSysUser) SecurityUtils.getSubject().getPrincipal();
	}

	protected Long getUserId() {
		return getUser().getSysUserId();
	}

	protected Long getDeptId() {
		return getUser().getDeptId();
	}

	protected Long getDeptUserId(){
		if(getUserId().intValue()!=1){
			return getUserId();
		}
		return null;
	}
}
